package Drawers;

import org.eclipse.swt.graphics.*;
import Utils.*;

public class MemoryDrawer implements Drawer {
	private boolean _stoped;
	private ImageData _imageD;
	
	public MemoryDrawer()
	{
		_stoped = false;
	}
	
	public void Stop()
	{
		_stoped = true;
	}
	
	public boolean ToStop()
	{
		return _stoped;
	}
	
	public void Start(Point size, PaletteData palette)
	{
		_imageD = new ImageData(size.x, size.y, 24, Functions.ClearPalette());
		_stoped = false;
	}
	
	public ImageData GetMemory()
	{
		return _imageD;
	}
	
	public void Finish()
	{
	}
	
	public void PutPixel(int x, int y, int color)
	{
		_imageD.setPixel(x, y, color);
	}
	
	public void PutPixel(int iter, byte r, byte g, byte b)
	{
		_imageD.data[iter] = r;
		_imageD.data[iter + 1] = g;
		_imageD.data[iter + 2] = b;
	}
	
	public int BytesPerLine()
	{
		return _imageD.bytesPerLine;
	}
}
